import { ProFormColumnsType, ProFormLayoutType } from '@ant-design/pro-form';
import {
  CascaderProps,
  DatePickerProps,
  FormItemProps,
  FormProps,
  InputNumberProps,
  InputProps,
  SelectProps,
  SwitchProps,
  TimePickerProps,
} from 'antd';
import { RangePickerProps } from 'antd/lib/date-picker/generatePicker';
import { TextAreaProps } from 'antd/lib/input';
import {
  SliderBaseProps,
  SliderRangeProps,
  SliderSingleProps,
} from 'antd/lib/slider';
interface Iparameter extends FormItemProps {
  key: string;
  wrapperCol?: {
    xs: {
      span: number;
      offset: number;
    };
    sm: {
      span: number;
      offset: number;
    };
  };
  labelCol?: {
    xs: {
      span: number;
      offset: number;
    };
    sm: {
      span: number;
      offset: number;
    };
  };
  initialvalues?: Array<String> | string;
  rules?: Array<any>;
}

interface IselectParameter<RecordType> extends SelectProps<RecordType> {
  optionArr: Array<{ value: string; label: string }>;
}

interface Iitem<RecordType> {
  type:
    | 'Input'
    | 'Input.Password'
    | 'Input.TextArea'
    | 'Cascader'
    | 'Select'
    | 'DatePicker'
    | 'InputNumber'
    | 'Switch'
    | 'RangePicker'
    | 'Slider'
    | 'TimePicker';
  parameter: Iparameter;

  inputParameter?: InputProps;
  cascaderParameter?: CascaderProps;
  selectParameter?: IselectParameter<RecordType>;
  datePickerParameter?: DatePickerProps;
  inputNumberParameter?: InputNumberProps;
  switchParameter?: SwitchProps;
  textAreaParameter?: TextAreaProps;
  rangePickerParameter?: RangePickerProps<RecordType>;
  sliderParameter?: SliderBaseProps | SliderRangeProps | SliderSingleProps;
  timePickerParameter?: TimePickerProps;
}

interface DataItem {
  name: string;
  state: string;
}

interface IBetaSchemaForm {
  columns: ProFormColumnsType<DataItem>[];
  trigger: JSX.Element;
  layoutType: ProFormLayoutType;
  onFinish: () => Promise<boolean | void>;
}

interface IproFormProps<RecordType extends object = any> {
  items?: Array<Iitem<RecordType>>;
  formParameter?: FormProps<RecordType>;
  actionParameter?: Array<JSX.Element> | JSX.Element;
  betaSchemaFormJson?: IBetaSchemaForm;
}

export default IproFormProps;
